package com.by.controller;

import com.by.common.bean.ResultBean;
import com.by.common.controller.BaseController;
import com.by.service.PurchaserDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/purchaseDetail")
@Api(tags = "采购单明细")
public class PurchaseDetailController extends BaseController {
    @Autowired
    PurchaserDetailService service;
    @ApiModelProperty("根据采购单id查询明细")
    @GetMapping("/detail")
    //单个参数加文档注释 多个使用ApiImplicitParams对象
    @ApiImplicitParam(name = "purchaseId",value = "采购单id",required = true,dataTypeClass = Integer.class)
    public ResultBean queryDetail(@RequestParam(name = "purchaseId",required = true)int purchaseId){
        List list=service.queryByPurchaseId(purchaseId);
        return success("明细列表",list);
    }
}
